<template>
	<view class="hot" @click="handleClick">
		<view class="hot-cell">
			<image :src="info.cover" mode="aspectFill" class="cover" v-if="info.cover"></image>
			<view class="hot-info">
				<view class="head">
					<view class="title-view">
						<view class="hot-title ellipsis-2">
							{{info.title}}
						</view>
						<view class="author">
							<!-- <text>作者：</text> -->
							<text>{{info.subtitle}}</text>
						</view>
					</view>
					<view class="icon-view" @click.stop="handleCollection">
						<image :src="collectionIocn" class="collection-icon" mode="" v-if="info.favorited==='1'"></image>
						<image :src="emptyCollectionIocn" class="collection-icon" mode="" v-else></image>
					</view>
				</view>
				<view class="desc-view">
					{{info.desc}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	const collectionIocn = ref("/static/images/index/yishoucang@3x.png")
	const emptyCollectionIocn = ref("/static/images/index/quxiaoshoucang@3x.png")
	const props = defineProps(['info'])
	const emit = defineEmits(['onCollection','select']);
	const info = reactive(props.info)
	const handleClick = () => {
		emit('select')
	}
	const handleCollection = () => {
		emit('onCollection')
	}
	
</script>

<style lang="scss" scoped>
	.hot {
		height: 240rpx;
		margin-top: 32rpx;

		.hot-cell {
			display: flex;
			align-items: center;

			.cover {
				width: 180rpx;
				height: 240rpx;
				box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.2);
				border-radius: 20rpx;
				overflow: hidden;
				margin-right: 24rpx;
			}

			.hot-info {
				flex: 1;
				height: 100%;
				text-align: left;

				.head {
					width: 100%;
					display: flex;
					justify-content: space-between;
				}

				.title-view {}
				.icon-view{
					display: flex;
					flex-shrink: 0;
					padding-left: 20rpx;
				}
				.collection-icon {
					width: 68rpx;
					height: 68rpx;
				}

				.desc-view {
					margin-top: 40rpx;
					width: 470rpx;
					color: #626666;
					font-size: 28rpx;
					line-height: 40rpx;
				}

				.hot-title {
					width: 380rpx;
					font-size: 32rpx;
					font-weight: 500;
					color: #1A1A1A;
					line-height: 40rpx;
				}

				.author {
					font-size: 24rpx;
					color: #939999;
					line-height: 24rpx;
					margin: 16rpx 0 28rpx 0;
				}

				.play-button {
					width: 208rpx;
					height: 68rpx;
					background: linear-gradient(315deg, #43D9F0 0%, #5CE5D5 100%);
					border-radius: 59rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 24rpx;
					color: #FFFFFF;
				}

				.play-icon {
					width: 20rpx;
					height: 26rpx;
					margin-right: 8rpx;
				}
			}
		}


	}
</style>